<?php
/**
 * SweetPlurk
 *
 * @package    SweetPlurk
 * @copyright  Copyright (c) 2008-2012 Wabow Information Inc. (http://www.wabow.com)
 * @license    New BSD License
 * @version    $Id$
 */

/**
 * User 類別
 *
 * @package    SweetPlurk
 * @copyright  Copyright (c) 2008-2012 Wabow Information Inc. (http://www.wabow.com)
 * @license    New BSD License
 */
class SweetPlurk_User extends SweetPlurk_Go
{
    /**
     * 建構
     *
     * @param object $userData
     */
    public function __construct($userData)
    {
        parent::__construct($userData);
    }

    /**
     * 取得 Plurk
     *
     * @param int $plurkId
     * @return SweetPlurk_Plurk
     */
    public function getPlurk($plurkId)
    {
        $plurkData = parent::$_connector->send('/Timeline/getPlurk', array(
            'plurk_id:' => $plurkId,
        ));
        return new SweetPlurk_Plurk($plurkData);
    }

    /**
     * 取得 Plurks 集合
     *
     * @param int $plurkId
     * @return SweetPlurk_Plurks
     */
    public function getPlurks($options = array())
    {
        $plurksData = parent::$_connector->send('/Timeline/getPlurks', $options);
        return new SweetPlurk_Plurks($plurksData);
    }

    /**
     * 取得使用者私有 Profile
     *
     * @return SweetPlurk_Profile
     */
    public function getProfile()
    {
        $profileData = parent::$_connector->send('/API/Profile/getOwnProfile', array());
        return new SweetPlurk_Profile($profileData);
    }

    /**
     * 新增 Plurk
     *
     * @param string $content
     * @param string $qualifier
     * @param string $lang
     * @return SweetPlurk_Plurk
     */
    public function addPlurk($content, $qualifier = 'says', $lang = 'tr_ch')
    {
        $plurkData = parent::$_connector->send('/Timeline/plurkAdd', array(
            'content' => $content,
            'qualifier' => $qualifier,
            'lang' => $lang,
        ));
        return new SweetPlurk_Plurk($plurkData);
    }
}